import java.io.FileNotFoundException;
import java.util.Scanner;
/*********************************************************************
 * HW 5:  Implement a two level process Q sorted in each subQ 
 *
 * @author Duncan Buell
**/
public class Driver
{
/*********************************************************************
 * main method
**/
  public static void main (String[] args) throws FileNotFoundException
  {
    final String classLabel = "Main: ";
    Scanner inFile = null;
    ProcessRecord rec = null;
    MultiList theList;
    
    inFile = FileUtils.ScannerOpen("zin");
    FileUtils.setLogFile("zlog");

    theList = new MultiList();

    while(inFile.hasNext())
    {
      rec = new ProcessRecord();
      rec = rec.readProcessRecord(inFile);
      theList.insert(rec);
      FileUtils.logFile.printf("%s added record '%s'%n",
                   classLabel,rec.toString());

    } // while(inFile.hasNext())

    /*********************************************************************
     * We have finished reading the input data, so we echo the list.
    **/
    FileUtils.logFile.printf("\nThe List of %d items is%n%s%n",
                 theList.getSize(),theList.toString());

    /*********************************************************************
     * Dump the list.
    **/
     theList.dump();

    /*********************************************************************
     * And then we're done.
    **/
    FileUtils.logFile.printf("%s no more data, terminate%n",classLabel);
    
    FileUtils.closeLogFile();
  }
} // public class Main

